# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Maintainer: T.J. Townsend <blakkheim@archlinux.org>
# Contributor: Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
# Contributor: graysky <therealgraysky AT protonmail DOT com>
# Contributor: Mateusz Herych <heniekk@gmail.com>
# Contributor: Army <uli[dot]armbruster[at]gmail[dot]com>

# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
#  - configure with --without-lto

pkgname=ncmpcpp
pkgver=0.9.2
pkgrel=19
pkgdesc='Almost exact clone of ncmpc with some new features'
url='https://ncmpcpp.rybczak.net/'
arch=('x86_64')
license=('GPL-2.0-only')
depends=('curl' 'libcurl.so' 'libmpdclient' 'libmpdclient.so' 'fftw' 'libfftw3.so' 'boost-libs'
         'libboost_filesystem.so' 'libboost_locale.so' 'libboost_program_options.so'
         'libboost_thread.so' 'icu' 'libicui18n.so' 'libicuuc.so'
         'glibc' 'gcc-libs' 'ncurses' 'libncursesw.so' 'readline' 'libreadline.so' 'taglib')
makedepends=('boost' 'git')
source=(git+https://github.com/ncmpcpp/ncmpcpp.git#tag=${pkgver}
        taglib-2.patch)
sha512sums=('e40b19318af5c191a9397fbd337a2e807d945ae06d6bc349c9555c58820f59afba70448b030541754870d30f0fe78630e028611e184c8b25368c734bc51a7c87'
            'fff2987f193bb0d0423b32d81d79dda4c8dd451f701b587a3456867387697736381e4e09489ea852f648449c8a0ec9fbb386f74b7207249abf12dfd4a8f54f36')
b2sums=('babc1506eca6dc5bd48e58fabfd42502d33b506b2e600b7aa98126a6deb0d68e14dc692abb0ef5079e3ccf710648f0b82fe1b404303d932f2156104c479442ec'
        '7e45e21e493d3da4039ac27f1f3158cdc244b6df369d7a452f770ac068ae2635d60a9ea19f166f3f6eaa5a766f25a6ed76edd83c8700c0f53b492b170b806320')

prepare() {
  cd ${pkgname}
  patch -p1 -i ../taglib-2.patch
  autoreconf -fiv
  sed -e 's/CXXFLAGS=/CXXFLAGS+=/' \
      -e 's/CPPFLAGS=/CPPFLAGS+=/' \
      -e 's/LDFLAGS=/LDFLAGS+=/' \
      -e 's/-march=native//' \
      -i extras/Makefile
}

build() {
  cd ${pkgname}

  # http://site.icu-project.org/download/61#TOC-Migration-Issues
  export CPPFLAGS+=' -DU_USING_ICU_NAMESPACE=1'

  # Work around deprecated TagLib::String::null from TagLib 1.12
  CXXFLAGS+=' -Wno-error=deprecated-declarations'

  BOOST_LIB_SUFFIX='' ./configure \
    --prefix=/usr \
    --enable-clock \
    --enable-outputs \
    --enable-visualizer \
    --with-fftw \
    --with-taglib \
    --without-lto
  make
  make -C extras
}

package() {
  cd ${pkgname}
  make DESTDIR="${pkgdir}" install
  install -Dm 755 extras/artist_to_albumartist -t "${pkgdir}/usr/bin"
}

# vim: ts=2 sw=2 et:
